﻿using S.RBAC.Domain.Model;
using S.RBAC.Infrastructure.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace S.RBAC.Infrastructure.Impl
{
    public class RoleRepository : BaseRepository<Role>, IRoleRepository
    {
        public RoleRepository(EFCoreContext context) : base(context)
        {
        }

        public async Task<int> AddRole(Role role)
        {
            return await AddAsync(role);
        }

        public async Task<List<Role>> GetAllRole()
        {
            return await GetAllAsync();
        }

        public async Task<Role> GetRoleById(int id)
        {
            return await GetAsync(id);
        }

        public async Task<List<Role>> GetRoleInfo(Expression<Func<Role, bool>> expre)
        {
            return await GetListAsync(expre);
        }

        public async Task<int> UpdRole(Role role)
        {
            return await UpdateAsync(role);
        }
    }
}
